package simplescenegraph.utils;

public final class StringUtils {

	public static <T> String join(T[] array, char space, int starting) {
		if (array == null || starting < 0) {
			throw new IllegalArgumentException();
		}
		
		if (array.length == 0) return "";
		
		String joinedArray = "";
		for (int i = starting; i < array.length; i++) {
			T element = array[i];
			joinedArray += element;
			joinedArray += space;
		}
		
		return joinedArray.substring(0, joinedArray.length() - 1);
	}
	
	public static <T> String join(T[] array, char space) {
		if (array == null) {
			throw new IllegalArgumentException();
		}
		
		return join(array, space, 0);
	}

}
